#ifndef CNC_BASE_MILL_DATABASE_H
#define CNC_BASE_MILL_DATABASE_H

#include "milldb_.h"
// provided interfaces
//	#include "millpdata.h"
// basic component model
#include <bcm/bcm.h>

namespace cnc {

	namespace base {

		/**
		@brief Milling Machine Parameter Database Component.
		
		This class implements a milling machine parameter database component.
		*/

		class MillDatabase : public bcm::Identifier<bcm::Component>,
			public MillDatabaseImpl
		{
		protected:
			MillDatabase() : bcm::Identifier<bcm::Component>("milldb", "Mill Database")
			{
			}
		protected: // bcm::Component
			virtual bcm::IdentifierData *getProvidedInterfaceTable()
			{
				static bcm::IdentifierData idData[] = {
					{ "taskctl", "Task Control" },
					{ "pdata", "Permanent Data" },
					{ "millpdata", "Mill Permanent Data" },
					{ 0, 0 }
				};
				return idData;
			}
			virtual bcm::IdentifierData *getRequiredInterfaceTable()
			{
				static bcm::IdentifierData idData[] = {
					{ 0, 0 }
				};
				return idData;
			}
			virtual bcm::Interface *getInterface(const char *id)
			{
				if (std::string("taskctl") == id)
					return getTaskControl();
				else if (std::string("pdata") == id)
					return getPersistentData();
				else if (std::string("millpdata") == id)
					return getMillPersistentData();
				return 0;
			}
			virtual bool setInterface(bcm::Interface *iface)
			{
				return false;
			}
		public:
			static MillDatabase &instance(bcm::GetComponentResult *result)
			{
				static MillDatabase object;
				if (result != 0)
					*result = object.result_;
				return object;
			}
		};

	} // namespace base

} // namespace cnc

#endif

